<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 */

class Modules_News_Controllers_Rss extends Gio_Core_Controller
{
	public function categoryAction()
	{
		$this->disableLayout();
		$request = $this->getRequest();
		$start = 0;
		$perPage = 20;
		$condition = array(
					'category_id' => $request->getParam('category_id'),
					'status' => 'active',
					
		);
		$articles = Modules_News_Services_Article::find($start, $perPage, $condition);
		$this->view->articles = $articles;
		
		$buildDate = date('D, d M Y h:i:s');
		$this->view->buildDate = $buildDate;
		header('Content-Type: application/rss+xml; charset=utf-8');
	}
	
	public function indexAction()
	{
		$this->disableLayout();
		$start = 0;
		$perPage = 20;
		$condition = array(
					'status' => 'active'
		);
		$articles = Modules_News_Services_Article::find($start, $perPage, $condition);
		$this->view->articles = $articles;
		
		$buildDate = date('D, d M Y h:i:s');
		$this->view->buildDate = $buildDate;
		header('Content-Type: application/rss+xml; charset=utf-8');
	}
}